package com.huabo.system.oracle.mapper;

import com.hbfk.util.PageInfo;
import com.huabo.system.oracle.entity.TblHomePageModel;
import com.huabo.system.oracle.entity.TblIndicator;

import java.math.BigDecimal;

public class TblIndicatorMapperSqlConfig {


    public String findIndicatorByUseridAndSlouid(PageInfo<TblIndicator> pageInfo, BigDecimal staffid) {
        StringBuffer sbSql = new StringBuffer("SELECT * FROM ( SELECT BUDGET.*,ROWNUM RNUM FROM ( SELECT * from TBL_INDICATOR ind LEFT JOIN TBL_MONITOR_SOLUTION_INDICATOR msi on IND.INDICATORID=MSI.INDICATORID LEFT JOIN TBL_MONITOR_SOLUTION TMS ON TMS.SOLUTIONID = TMS.SOLUTIONID LEFT JOIN TBL_MONITOR_SOLUTION_STAFF TMSS ON TMS.SOLUTIONID = TMSS.SOLUTIONID where TMSS.STAFFID= '"+staffid+"' and TMS.TYPE=2 " );


        sbSql.append(" ) BUDGET WHERE rownum <= "+(pageInfo.getCurrentPage()*pageInfo.getPageSize())+" ) WHERE RNUM > "+pageInfo.getCurrentRecord());
        String sql = sbSql.toString();
        return sql;
    }

    public String findIndicatorByJKZX(String solutionid, PageInfo<TblIndicator> pageInfo) {
        StringBuffer sbSql = new StringBuffer("SELECT * FROM ( SELECT BUDGET.*,ROWNUM RNUM FROM ( select * from TBL_INDICATOR TI LEFT JOIN TBL_MONITOR_SOLUTION_INDICATOR TMSI ON TI.INDICATORID =TMSI.INDICATORID LEFT JOIN TBL_MONITOR_SOLUTION TMS ON TMSI.SOLUTIONID = TMS.SOLUTIONID WHERE TMS.SOLUTIONID ="+solutionid );


        sbSql.append(" ) BUDGET WHERE rownum <= "+(pageInfo.getCurrentPage()*pageInfo.getPageSize())+" ) WHERE RNUM > "+pageInfo.getCurrentRecord());
        String sql = sbSql.toString();
        return sql;
    }
}
